CurrentVersion = 1.0
GM.Name 	= "Producer "..CurrentVersion
GM.Author 	= "Dacre Denny"
GM.Email 	= "dacredens@gmail.com"
GM.Website 	= "dacredenny.com"

//This is unfortuantly nessisary to make image buttons work :/
DeriveGamemode("sandbox")  

TEAM_DEFAULT = 1
function GM:SetupTeams()

	// Create your teams here
	team.SetUp(TEAM_DEFAULT, "Default Team", Color(255, 50, 50, 255))  
	
end

function GM:PlayerConnect( name, address, steamid )

end

function GM:PlayerShouldTakeDamage( ply, attacker )
	if attacker:IsPlayer() then
		if ply:Team() == attacker:Team() and attacker != ply then
			return false
		else
			return true
		end
	else
		return true
	end
end

VOTING_ENABLED = false
VOTING_TIME = 15

Votes = {}
Votes.Game = {}
Votes.Map = {}
Votes.Gamemodes = {}

function RegisterGamemode(name,foldername,mapprefixes)
	local tbl = {}
	if type(mapprefixes) == "string" then
		tbl = {name,foldername,{mapprefixes}}
		table.insert(Votes.Gamemodes,tbl)
	else
		tbl = {name,foldername,mapprefixes}
		table.insert(Votes.Gamemodes,tbl)
	end
end

// First arg is player steam id, second arg is a table of stuff to save
function WriteToFile(ID,tbl)
	local Name = ID..".txt"
	local str
	for k,v in pairs(tbl) do
		if str == nil then
			str = tostring(v)
		else
			str = str.."~"..tostring(v)
		end
	end
	file.Write(Name, str) 
end

// First arg is player steam id, this function returns a table!
function OpenFromFile(ID)
	local loaded = {}
	local Name = ID..".txt"
	if file.Exists(Name) then
		loaded = string.Explode("~",file.Read(Name))
	end
return loaded end 